package com.cnbm.wcsbasic.dispatch.enums.line.plc2;


import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.api.DaveArea;
import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.type.PlcVar;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2023/2/21 19:35
 */
public enum Wcs2PlcVar {

    //12001 开始
    RW_FLAG_12001("RW_FLAG_12001", PlcVar.BYTE,1, DaveArea.DB,1,0,0),
    MISSION_TYPE_12001("MISSION_TYPE_12001", PlcVar.BYTE,1, DaveArea.DB,1,1,0),
    TASK_ID_12001("TASK_ID_12001", PlcVar.INT,1, DaveArea.DB,1,2,0),
    DEST_EQ_ID_12001("DEST_EQ_ID_12001", PlcVar.INT,1, DaveArea.DB,1,4,0),
    EQ_UNLOCK_12001("EQ_UNLOCK_12001", PlcVar.BYTE,1, DaveArea.DB,1,6,0),
    GOODS_SIZE_12001("GOODS_SIZE_12001", PlcVar.BYTE,1, DaveArea.DB,1,7,0),
    ACTION_TYPE_12001("ACTION_TYPE_12001", PlcVar.BYTE,1, DaveArea.DB,1,8,0),
    SCAN_CONFIRM_12001("SCAN_CONFIRM_12001", PlcVar.BYTE,1, DaveArea.DB,1,11,0),
    //12001 结束

    //12002 开始
    RW_FLAG_12002("RW_FLAG_12002", PlcVar.BYTE,1, DaveArea.DB,1,12,0),
    MISSION_TYPE_12002("MISSION_TYPE_12002", PlcVar.BYTE,1, DaveArea.DB,1,13,0),
    TASK_ID_12002("TASK_ID_12002", PlcVar.INT,1, DaveArea.DB,1,14,0),
    DEST_EQ_ID_12002("DEST_EQ_ID_12002", PlcVar.INT,1, DaveArea.DB,1,18,0),
    EQ_UNLOCK_12002("EQ_UNLOCK_12002", PlcVar.BYTE,1, DaveArea.DB,1,20,0),
    GOODS_SIZE_12002("GOODS_SIZE_12002", PlcVar.BYTE,1, DaveArea.DB,1,21,0),
    ACTION_TYPE_12002("ACTION_TYPE_12002", PlcVar.BYTE,1, DaveArea.DB,1,22,0),
    SCAN_CONFIRM_12002("SCAN_CONFIRM_12002", PlcVar.BYTE,1, DaveArea.DB,1,25,0),
    //12002 结束


    //12003 开始
    RW_FLAG_12003("RW_FLAG_12003", PlcVar.BYTE,1, DaveArea.DB,1,24,0),
    //12003 结束


    //12004 开始
    RW_FLAG_12004("RW_FLAG_12004", PlcVar.BYTE,1, DaveArea.DB,1,36,0),
    MISSION_TYPE_12004("MISSION_TYPE_12004", PlcVar.BYTE,1, DaveArea.DB,1,37,0),
    TASK_ID_12004("TASK_ID_12004", PlcVar.INT,1, DaveArea.DB,1,38,0),
    DEST_EQ_ID_12004("DEST_EQ_ID_12004", PlcVar.INT,1, DaveArea.DB,1,40,0),
    EQ_UNLOCK_12004("EQ_UNLOCK_12004", PlcVar.BYTE,1, DaveArea.DB,1,42,0),
    GOODS_SIZE_12004("GOODS_SIZE_12004", PlcVar.BYTE,1, DaveArea.DB,1,43,0),
    ACTION_TYPE_12004("ACTION_TYPE_12004", PlcVar.BYTE,1, DaveArea.DB,1,44,0),
    SCAN_CONFIRM_12004("SCAN_CONFIRM_12004", PlcVar.BYTE,1, DaveArea.DB,1,47,0),
    //12004 结束


    //12006 开始
    RW_FLAG_12006("RW_FLAG_12006", PlcVar.BYTE,1, DaveArea.DB,1,60,0),
    //12006 结束

    ;

    private String name;
    private DaveArea area;
    private Integer areaNumber;
    private Integer byteOffset;
    private Integer bitOffset;
    private PlcVar type;
    //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度，和read操作相关
    //如果是String 类型不用填length 只需要填string类型的起始位置就行了，我会自己去取数据长度（也就是说这里的length并不是string 的长度）。
    private Integer length;

    //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度
    private Integer strSize;

    Wcs2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = 0;
    }

    Wcs2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = strSize;
    }

    public Integer getStrSize() {
        return strSize;
    }

    public void setStrSize(Integer strSize) {
        this.strSize = strSize;
    }

    public String getName() {
        return name;
    }

    public DaveArea getArea() {
        return area;
    }

    public Integer getAreaNumber() {
        return areaNumber;
    }

    public Integer getBitOffset() {
        return bitOffset;
    }

    public Integer getByteOffset() {
        return byteOffset;
    }

    public PlcVar getType() {
        return type;
    }

    public Integer getLength() {
        return length;
    }
}
